package org.rency.crawler.fetch;

import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.rency.crawler.fetch.service.grade.GradeService;
import org.rency.crawler.fetch.service.policy.PolicyService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 名称:FetchConfiguration
 * 描述:${TODO}
 *
 * @author:rency
 * @version:V1.0.0
 * @JDK 1.8
 * @since 2017/11/22 20:44
 */
@Configuration
public class FetchConfiguration {

  @Resource(name = "robotsPolicyService")
  private PolicyService robotsPolicyService;

  @Resource(name = "intervalPolicyService")
  private PolicyService intervalPolicyService;

  @Resource(name = "duplicatePolicyService")
  private PolicyService duplicatePolicyService;

  @Resource(name = "ocipGradeService")
  private GradeService  ocipGradeService;

  @Bean
  public List<PolicyService> policyServices(){
    List<PolicyService> services = new ArrayList<>(3);
    services.add(duplicatePolicyService);
    services.add(intervalPolicyService);
    services.add(robotsPolicyService);
    return services;
  }

  @Bean
  public List<GradeService> gradeServices(){
    return Lists.newArrayList(ocipGradeService);
  }
}
